package com.shinbada.modules.sys.vo;

import com.shinbada.modules.sys.entity.SysConfig;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * @author initcap
 * @date Created in 2021/3/19 10:00.
 */
@Data
@ApiModel("系统安全配置")
public class SysConfigVo {

    @ApiModelProperty("产品名称")
    private String productName;

    @ApiModelProperty("允许多登录1，不允许0")
    private String multiAccountLogin;

    @ApiModelProperty("后登陆踢出先登录1，已经登陆禁止再登陆2.")
    private String singleLoginType;

    @ApiModelProperty("开启初始密码强制修改 true false")
    private String firstLoginChangePassword;

    @ApiModelProperty("开启强密码验证 true false")
    private String strongPassword;

    @ApiModelProperty("连续【】次密码错误，锁定用户账号")
    private Integer errInputPasswordTimes;

    @ApiModelProperty("设置默认初始密码")
    private String defaultPassword;

    @ApiModelProperty("密码强制更换周期（天）【-1不强制】")
    private Integer passwordChangePeriod;

    @ApiModelProperty("登录页地址")
    private String loginPath;

    private String administratorCompanyId;

    private String administratorPassword;

    public static SysConfigVo of(SysConfig config) {
        SysConfigVo configVo = new SysConfigVo();
        BeanUtils.copyProperties(config, configVo);
        configVo.setAdministratorPassword(SysConfig.VIEW_PASSWORD);
        return configVo;
    }
}
